package interview.continer;

import java.util.*;
import java.util.concurrent.CopyOnWriteArraySet;

public class SetUnsafeDemo {

    public static void main(String[] args) {

        Set<String> set = new HashSet<>();
       // Set<String> set = Collections.synchronizedSet(new HashSet<>());
        //Set<String> set = new CopyOnWriteArraySet<>();
        for(int i=0;i<30;i++){
            new Thread(()->{
                set.add(UUID.randomUUID().toString().substring(0,8));
                System.out.println(Thread.currentThread().getName()+":"+set);
            },String.valueOf(i)).start();
        }
    }

    }

